package com.learnosity.extendotext.style
{
	import com.learnosity.extendotext.Rule;
	import flash.text.engine.ElementFormat;
	import flash.text.engine.TextBaseline;
		
	public class VerticalAlign
	{

		static public function apply(rule:Rule,format:ElementFormat):ElementFormat{
			//Set value to lower case
			rule.value = rule.value.toLowerCase();
			if(rule.value == 'sup'){
				format.alignmentBaseline = TextBaseline.IDEOGRAPHIC_TOP;
			}
			else if(rule.value == 'sub'){
				format.alignmentBaseline = TextBaseline.IDEOGRAPHIC_BOTTOM;
			}else{
				format.alignmentBaseline = TextBaseline.USE_DOMINANT_BASELINE;
			}
			return format;
		}

	}
}